<template>
  <div class="layout-container">
    <!-- 左侧菜单区域 -->
    <el-menu
        :default-active="activeIndex"
        class="left-menu"
        @open="handleOpen"
        @close="handleClose"
        background-color="#333"
        text-color="#fff"
        active-text-color="#409EFF"
        router
    >
      <el-submenu index="1">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>首页导航</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/" :key="index">
            <span>首页</span>
          </el-menu-item>
          <el-menu-item index="/about" :key="index">
            <span>关于我们</span>
          </el-menu-item>
        </el-menu-item-group>
      </el-submenu>



      <el-submenu index="2">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>候选人管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/candidateList" :key="index">
            <span>候选人列表</span>
          </el-menu-item>
          <el-menu-item index="/createCandidate" :key="index">
            <span>创建候选人</span>
          </el-menu-item>
          <el-menu-item index="/c" :key="index">
            <span>面试记录</span>
          </el-menu-item>
        </el-menu-item-group>
      </el-submenu>



      <el-submenu index="3">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>职位管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/jobList" :key="index">
            <span>职位列表</span>
          </el-menu-item>
          <el-menu-item index="/createJob" :key="index">
            <span>创建职位</span>
          </el-menu-item>

        </el-menu-item-group>
      </el-submenu>



      <el-submenu index="4">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>AI面试官</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/digitalInterviewerManagement" :key="index">
            <span>面试官设置</span>
          </el-menu-item>
          <el-menu-item index="/questionLibList" :key="index">
            <span>面试题库</span>
          </el-menu-item>

        </el-menu-item-group>
      </el-submenu>
    </el-menu>
    <!-- 右侧内容区域 -->
    <div class="right-content">
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      activeIndex: '/' // 默认激活的菜单索引，这里设置为首页路由
    };
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log('菜单展开：', key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log('菜单关闭：', key, keyPath);
    }
  }
};
</script>

<style scoped>
.layout-container {
  display: flex;
  height: 100vh;
}
.left-menu {
  width: 200px;
  min-width: 150px;
}
.right-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}
</style>